<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Locais extends CI_Controller {

	function __construct() {
		parent::__construct();
		if(!$this->session->userdata('disproju')){
			$this->session->sess_destroy();
			redirect('login', 'refresh');
		}
	}
	public function index()
	{
		$this->load->view('welcome_message');
	}
	public function consultaLocalJson(){
	
		$nome_local = $_GET['term'];
		
		$local = new Local();
		$local->like('nome_local', $nome_local);
		$local->get();
		
		$dados = array();
		$aux = array();
		foreach($local as $u){
			$aux["value"] = $u->nome_local;
			$aux["name"] = $u->nome_local;
			$aux["id"] = $u->id;
			array_push($dados,$aux);
		}
		echo json_encode($dados);
	
	}
	
	
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */